import Vue from 'vue';
import FastClick from 'fastclick';
import * as Sentry from '@sentry/browser';
import * as Integrations from '@sentry/integrations';
import { fetch, isProduction } from 'utils';
import App from './App.vue';
import router from './router';
import store from './store';
import 'utils/component-use'; // global componentss
import 'utils/permission'; // router operation
import 'lib-flexible';
import 'normalize.css';

isProduction &&
  Sentry.init({
    dsn: 'https://33580eb2d8e643c8a8c43b06455cfc7d@o385661.ingest.sentry.io/5218788',
    integrations: [
      new Integrations.Vue({
        Vue,
        attachProps: true,
      }),
    ],
    logErrors: true,
  });

// 定制化一些错误上报
// eslint-disable-next-line
Vue.config.errorHandler = (err, vm, info) => {
  console.error(err);
};

Vue.config.productionTip = false;

Vue.prototype.$http = fetch;

FastClick.attach(document.body);

new Vue({
  router,
  store,
  render: (h) => h(App),
  // mounted() {
  //   document.dispatchEvent(new Event('render-event'));
  // },
}).$mount('#app');
